package net.lesscoding.controller;

import lombok.RequiredArgsConstructor;
import net.lesscoding.Result;
import net.lesscoding.service.StorageService;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author eleven
 * @date 2025/4/16 14:17
 * @apiNote
 */
@RestController
@RequestMapping("/storage")
@RequiredArgsConstructor
public class StorageController {

    private final StorageService storageService;

    @PostMapping("/deduct/{goodsCode}/{count}")
    public Result<Integer> deduct(@PathVariable("goodsCode") String goodsCode, @PathVariable("count") Integer count){
        return Result.success(storageService.deduct(goodsCode, count));
    }
}
